package com.keti.controller;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.keti.Dao.stuffDao;
import com.keti.DaoImpl.suffDaoImpl;
import com.keti.pojo.stuff;

/**
 * Servlet implementation class AddStuffServlet
 */
@WebServlet("/AddStuffServlet")
public class AddStuffServlet extends HttpServlet {
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");
		String sname = request.getParameter("sname");
		int count = Integer.parseInt(request.getParameter("count"));
		stuff s = new stuff();
		s.setSname(sname);
		s.setCount1(count);
		s.setCount2(count);
		s.setStatus("未领用");
		stuffDao sd = new suffDaoImpl();
		sd.add(s);
		response.sendRedirect("AdminInterfaceServlet");
		
		  
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
